﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Navigation;
using WpfApplication1.DBLayer;
//using WpfApplication1.DBStubs;

namespace WpfApplication1.LogicLayer
{
    public class BankTellerLogic
    {
        public static int UserLoginID;
        BankTellerDB UserLogin = new BankTellerDB();

       
        public bool Login(string nameIsValid, string passwordIsValid)
        {
            bool ret = false;


            if (nameIsValid == string.Empty && passwordIsValid == string.Empty)
            {
                ret = false;   //must enter 
            }
            else
            {
                bool exist = UserLogin.Login_Query(nameIsValid, passwordIsValid);
                if (exist == true)
                {

                    UserLoginID = UserLogin.get_userId();
                    Application.Current.Resources["UserLoginID"] = UserLoginID;

                    ret = true;


                }

            }
            return ret;
        }
        public BankAccount ProfileDisplay(string BankName, int UserID)
        {
            BankAccountDB BADB = new BankAccountDB();
            BankAccount Baccount = new BankAccount();
            List<BankAccount> Accounts = BADB.SelectProfileBank(BankName, UserID);
            foreach (BankAccount bankA in Accounts)
            {
                Baccount = bankA;
            }
            return Baccount;
        }

       
    }
}
